package com.xiaomi.mapper;

import com.xiaomi.entity.Signal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface SignalMapper {
    void insert(Signal signal);
    @Select("select * from signal_data where signal_id = #{id}")
    Signal selectById(Integer id);

    @Select("select * from signal_data where status != 1")
    // 查询status不等于1的signal_data表中的所有数据
    List<Signal> selectUnprocessedSignals();

    @Update("update signal_data set status = 1 where signal_id = #{signalId}")
    void updateStatus(Signal signal);

    @Select("select * from signal_data where vehicle_frameNumber = #{carFrameNumber}")
    List<Signal> selectByCarFrameNumber(Long carFrameNumber);

    List<Integer> selectAllFrameNumbers();

    Signal selectLatestByFrameNumber(Integer frameNumber);
}
